public class Test12_yield {
    public static void main(String[] args) {

    }
}
class YieldOne implements Runnable{

    @Override
    public void run() {
        if ("a".equals(Thread.currentThread().getName())){
            Thread.yield();//TODO:yield只会将执行权放给you先行级稿的线程

            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
        for (int i =0;i<10;i++){
            System.out.println(Thread.currentThread().getName()+":"+i);
        }
    }
}
